﻿using System.Windows;
using DSLPedProjectWizard.ViewModels;
using GalaSoft.MvvmLight.Messaging;

namespace DSLPedProjectWizard.Views
{
    /// <summary>
    /// Interaction logic for SettingsWizardView.xaml
    /// </summary>
    public partial class SettingsWizardView : IWizardPage
    {
        private SettingsWizardViewModel viewModel;

        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsWizardView"/> class.
        /// </summary>
        /// <param name="messenger">The messenger used for the communication between the wizard pages</param>
        public SettingsWizardView(Messenger messenger)
        {
            InitializeComponent();
            viewModel = new SettingsWizardViewModel(messenger);
            this.DataContext = viewModel;
        }

        /// <summary>
        /// Gets the value indicating that the wizard can finish
        /// </summary>
        public bool CanFinish
        {
            get
            {
                bool isValid = viewModel.IsValid();
                return isValid;
            }
        }

        /// <summary>
        /// Gets the name of DSL language
        /// </summary>
        public string LanguageName
        {
            get
            {
                return viewModel.LanguageName;
            }
        }

        /// <summary>
        /// Gets the DSL XML Namespace that is registered for the language
        /// </summary>
        public string LanguageXmlNamespace
        {
            get
            {
                return viewModel.LanguageXmlNamespace;
            }
        }

        /// <summary>
        /// Gets the language description
        /// </summary>
        public string LanguageDescription
        {
            get
            {
                return viewModel.LanguageDescription;
            }
        }

        #region IWizardPage

        /// <summary>
        /// Gets the view of this wizard page in a form of <see cref="FrameworkElement"/>
        /// </summary>
        public FrameworkElement View
        {
            get
            {
                return this;
            }
        }

        #endregion
    }
}
